package org.zxp.tmp;

import com.alibaba.fastjson.JSON;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.UnsupportedEncodingException;

/**
 * @program: effectiveJava
 * @description:
 * @author: X-Pacific zhang
 * @create: 2020-07-25 09:23
 **/
public class DelayTest {
    //public static void main(String[] args){
    //    sendmsg("CO");
    //    sendmsg("CR");
    //    sendmsg("CL");
    //    sendmsg("CU");
    //    sendmsg("CB");
    //}


    private static void sendmsg(String filePerfix)  {
        new Thread(()->{
            try {
                long begin = System.currentTimeMillis();
                if("CO".equals(filePerfix)) {//逾期延迟15分钟消费
                    Thread.sleep(1000*45);
                }else if("CR".equals(filePerfix)){//还款明细延迟30分钟消费
                    Thread.sleep(1000*2);
                }else if(",CL,CU,CB,".indexOf("," + filePerfix + ",") > -1){//放款明细、支用、借据延迟45分钟消费
                    Thread.sleep(1000*3);
                }else{//只有授信、还款计划不延迟消费
                }
                long end = System.currentTimeMillis();
                System.out.println("JF_POST_CHECK_MSG_RESULT "+filePerfix + "   "  + (end-begin));
            } catch (Exception e) {
                System.out.println("JF_POST_CHECK_MSG_ERROR");
            }
        }).start();

    }



    public static void main(String[] args) throws Exception {
        String str = FileUtils.readFileToString(new File("D:/a.txt"), "UTF-8");
        System.out.println(str.length());
        System.out.println(str.getBytes("UTF-8").length);
    }
}
